package com.wider.services.impl;

import com.wider.mapper.BaseDataMapper;
import com.wider.pojo.BaseData;
import com.wider.pojo.Tmp;
import com.wider.services.BaseDataService;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;


/**
 * @author Maple
 */
@Service
public class BaseDataServiceImpl implements BaseDataService {

    @Resource
    private BaseDataMapper baseDataMapper;

    private List<Integer> historytimeDifference = Arrays.asList(-240,-120,-60,-30,-20,-15,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1);
    private List<Integer> futuretimeDifference  = Arrays.asList(1,2,3,4,5,6,7,8,9,10,15,20,30,60,120,240);
    @Override
    public boolean insertBatchT(List<BaseData> baseDataList,String caseName){
        return baseDataMapper.insertBaseDataT(baseDataList,caseName) > 0;
    }

    @Override
    public List<BaseData> getBaseData(LocalDateTime startTime, LocalDateTime endTime, String caseName) {
        return baseDataMapper.getBaseData(startTime,endTime,caseName);
    }

    @Override
    public BaseData getFirstBaseData(String caseName) {
        return baseDataMapper.getFirstBaseData(caseName);
    }

    @Override
    public BaseData getFinallyBaseData(String caseName) {
        return baseDataMapper.getFinallyBaseData(caseName);
    }

    @Override
    public BaseData getNextBaseData(LocalDateTime startTime, String caseName) {
        return baseDataMapper.getNextBaseData(startTime,caseName);
    }


}
